package pl.softech.gpw.stat;

public class Indexes {

    /**
     * Relative Strength Index
     */
    public static double[] rsi(double[] arg, int n) {
        
        double[] ret = new double[arg.length];
        
        for(int i = 0; i < n - 1 && i < arg.length; i++) {
            ret[i] = 50;
        }
        
        for(int i = n - 1; i < arg.length; i++) {
            
            ret[i] = 100 - 100 / (1 + arg[i] / arg[i - n + 1]);
            
        }
        
        return ret;
        
    }
    
    
    
}
